package com.example.project.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.project.entity.Hotel;
import com.example.project.mapper.HotelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 酒店管理Controller
 *
 * @author changyao
 * @date 2024-11-11
 */
@RestController
@RequestMapping("/project/hotel")
public class HotelController
{
    @Autowired
    private HotelMapper hotelMapper;

    /**
     * 查询酒店管理列表
     */
    @GetMapping("/list")
    public List<Hotel> list()
    {
        QueryWrapper<Hotel> queryWrapper=new QueryWrapper<>();
        return hotelMapper.selectList(queryWrapper);
    }




    /**
     * 获取酒店管理详细信息
     */
    @PostMapping("/detil")
    public Hotel getInfo(@RequestBody Hotel hotel)
    {
        return hotelMapper.selectById(hotel);
    }


    /**
     * 新增酒店管理
     */
    @PostMapping("/add")
    public int add(@RequestBody Hotel hotel)
    {
        return hotelMapper.insert(hotel);
    }

    /**
     * 修改酒店管理
     */
    @PostMapping("/edit")
    public int edit(@RequestBody Hotel hotel)
    {
        return hotelMapper.updateById(hotel);
    }

    /**
     * 删除酒店管理
     */
	@PostMapping("/del")
    public int remove(@RequestBody Hotel hotel)
    {
        return hotelMapper.deleteById(hotel);
    }
}
